package com.example.mybatislearn.common.mapper;

import com.example.mybatislearn.common.mapper.exception.SmartMapperException;

import java.util.List;

public interface SmartMapper {
    /**
     * 创建指定类型的对象
     *
     * @param source
     * @param destinationClass
     * @param <T>
     * @return
     * @throws SmartMapperException
     */
    <T> T map(Object source, Class<T> destinationClass) throws SmartMapperException;

    /**
     * 进行属性的赋值
     *
     * @param source      object to convert from
     * @param destination object to convert to
     * @throws SmartMapperException mapping failure
     */
    void map(Object source, Object destination) throws SmartMapperException;

    /**
     * 映射集合
     * @param source
     * @param destinationClass
     * @param <T>
     * @return
     * @throws SmartMapperException
     */
    <T> List<T> mapList(List<Object> source,Class<T> destinationClass) throws SmartMapperException;


    /**
     * 映射集合
     * @param source
     * @param destination
     * @throws SmartMapperException
     */
    void map(List<Object> source, List<Object> destination) throws SmartMapperException;


}


